<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="">
    <script src="vue.global.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="content">
        <button @click="add">按钮</button>
        <h2>未完成</h2>
        <div v-for="(item,index) in list" :key="index">
            <h5 @click="bit">{{index+1}}、{{item.content}} ----- <span>{{dateFormat(newDate)}}</span></h5>
        </div>
        <h2>已完成</h2>
        <div v-for="(item,index) in items" :key="index">
            <h5>{{index+1}}、{{item.content}} ----- <span>{{dateFormat(newDate)}}</span></h5>
        </div>
    </div>
</body>
<script>
    const App = {
        data() {
            return {
                list: [],
                items: [],
                content: ''
            }
        },methods: {
            add() {
                this.list.push({
                    content: this.content
                })
            },
            bit() {
                this.items.push({
                    content: this.content
                })
                this.content = ''
            },
            dateFormat () {
                var date = new Date()
                var year = date.getFullYear()
                var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
                var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
                var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
                var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
                var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
                let week = date.getDay() 
                let weekArr = [ '星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六' ]
                return year + '年' + month + '月' + day + '日 ' + hours + ':' + minutes + ':' + seconds + ' ' + weekArr[week]
            }
        }    
    }
    Vue.createApp(App).mount('#app')
</script>
</html>